import request from '@/utils/request'

// 查询题目列表
export function listQuestion(query) {
    return request({
        url: '/ex/question/list',
        method: 'get',
        params: query
    })
}

// 根据题库查询题目集合
export function ids_bank(bankId) {
    return request({
        url: '/ex/question/ids-bank/' + bankId,
        method: 'get'
    })
}

// 查询题目详细
export function getQuestion(id) {
    return request({
        url: '/ex/question/' + id,
        method: 'get'
    })
}

// 新增题目
export function addQuestion(data) {
    return request({
        url: '/ex/question',
        method: 'post',
        data: data
    })
}

// 修改题目
export function updateQuestion(data) {
    return request({
        url: '/ex/question',
        method: 'put',
        data: data
    })
}

// 删除题目
export function delQuestion(id) {
    return request({
        url: '/ex/question/' + id,
        method: 'delete'
    })
}

//导入
export function importExcel(file,bankId){
  //组装参数
  let form = new FormData();
  form.append("file",file.raw)
  form.append("bankId",bankId)
  return request({
    url: '/ex/question/import',
    method: 'post',
    data:form,
    headers: {"Content-Type": "multipart/form-data; charset=utf-8"},
    contentType: false,
    processData: false,
    withCredentials: false
  })
}
